package com.mdinic.blogovi.front.page.follow;

import java.util.List;

import org.apache.wicket.markup.html.panel.Panel;

import com.mdinic.blogovi.front.common.AbstractMorePage;
import com.mdinic.blogovi.front.page.BSession;
import com.mdinic.blogovi.model.BlogPost;

public class FollowLinksPage extends AbstractMorePage<BlogPost> {

    private static final long serialVersionUID = 1L;

    public FollowLinksPage() {
        super(5, false);
    }

    @Override
    protected List<BlogPost> getList(int firstResult, int maxResults) {
        if (BSession.get().isFollowFilterRead()) {
            return BlogPost.findBlogPostsByFollowersRead(BSession.get().getPerson(), BSession.get().getFollowFilter(),
                    firstResult, maxResults);
        } else {
            return BlogPost.findBlogPostsByFollowersUnread(BSession.get().getPerson(),
                    BSession.get().getFollowFilter(), firstResult, maxResults);
        }

    }

    @Override
    protected Panel createPanel(List<BlogPost> list) {
        return new FollowBlogPostPanel(list);
    }
}
